#ifndef clox_scanner_h
#define clox_scanner_h

typedef enum {
    // 单字符 + - * / , ; ( ) { } .
    TOKEN_PLUS, TOKEN_MINUS, TOKEN_STAR, TOKEN_SLASH,
    TOKEN_COMMA, TOKEN_SEMICOLON, TOKEN_LEFT_PAREN, TOKEN_RIGHT_PAREN,
    TOKEN_LEFT_BRACE, TOKEN_RIGHT_BRACE, TOKEN_DOT,

    // 单或双字符 = == > >= < <= ! !=
    TOKEN_EQUAL, TOKEN_EQUAL_EQUAL, TOKEN_GREATER, TOKEN_GREATER_EQUAL,
    TOKEN_LESS, TOKEN_LESS_EQUAL, TOKEN_BANG, TOKEN_BANG_EQUAL,

    // 关键字 var fun class if else while for return this super and or nil print
    TOKEN_VAR, TOKEN_FUN, TOKEN_CLASS, TOKEN_IF, TOKEN_ELSE,
    TOKEN_WHILE, TOKEN_FOR, TOKEN_RETURN, TOKEN_THIS, TOKEN_SUPER,
    TOKEN_AND, TOKEN_OR, TOKEN_NIL, TOKEN_PRINT,

    // 字面量
    TOKEN_STRING, TOKEN_NUMBER, TOKEN_TRUE, TOKEN_FALSE,

    // 错误
    TOKEN_ERROR,

    // 标识符
    TOKEN_IDENTIFIER,

    // 结束
    TOKEN_EOF
} TokenType;

typedef struct
{
    TokenType type;
    const char* start;
    int len;
    int line;
} Token;

typedef struct
{
    const char* current;
    const char* start;
    int line;
} Scanner;

void initScanner(const char* src);
Token scanToken();
void printToken(Token token);

#endif
